1. Field of the Invention
The present invention relates to microprocessors. More specifically, the present invention relates to an idle state of a microprocessor that is accessed by an external electrical pin. When the electrical pin is asserted, it accesses the idle state in which the microprocessor is powered up, but instructions are not executing. The invention is useful for hardware or software debugging, remote diagnosis, and multi-processor synchronization.
2. Description of Related Art
Conventional microprocessors operate under the control of a sequence of instructions specified by a programmer. The instructions may be in the form of macroinstructions stored in memory that are supplied to the decoder, which decodes them into a series of one or more microinstructions. Microinstructions are a series of binary numbers in a form that the execution unit can understand. The microinstructions are applied, one after the other, from the instruction decoder to the execution unit.
For faster operation, many microprocessors use "pipelining," an implementation technique in which multiple microinstructions are overlapped in execution. A pipeline includes several stages that are performed in sequence. Instructions move from stage to stage; after an instruction completes one stage and moves to the next, the following instruction moves into that stage to take its place. In this way, instructions can be fetched, decoded, and executed quickly. As an example of pipelined operation, macroinstructions are decoded into microinstructions, which are applied one after the other to the execution unit or a "datapath", which executes the microinstructions to perform the operations specified therein. The execution unit may include a number of general purpose registers, an arithmetic unit (ALU), control registers, and some control logic. Instruction flow through a pipeline is controlled by a central control unit.
When a problem develops during execution of a program that may be the result of a hardware malfunction or software error, for example if the microprocessor simply stops, or if it begins outputting meaningless data, locating the cause of the problem may be extremely difficult. Typically when an error is encountered, a software debugger is sufficient. When a hardware malfunction is encountered, a lower level mechanism is needed, such as an in-circuit emulator or other hardware debugger.
When the microprocessor is a component of a computer installed at a remote location, expert diagnosis can be particularly difficult after the customer telephones with a complaint. If the system has shut down, or "crashed", direct keyboard control may be impossible. Even if the keyboard were usable, the expert who is analyzing the problem may be physically located elsewhere. In this instance, an expensive service call will usually be necessary. It would be an advantage to provide a microprocessor that can be diagnosed from a remote location:.
Particularly, to assist in ascertaining the cause of a problem, it would be an advantage to provide a microprocessor that can be stopped externally, without software intervention or control, so that the microprocessor can be analyzed to determine the cause of the problem.
Problems can also occur when a program is first being developed by an applications programmer. In order to assist the applications programmer in his development efforts, debugging tools have been developed. The debugging tools may be built into the hardware of a computer, or they may include a software-hardware combination. One debugging technique involves setting breakpoints at some position in the program's code. When encountered during program operation, breakpoints may halt program operation at the next convenient location and shift the program's operation into a debug mode. Because the normal flow of program operation is disrupted by a breakpoint, it may be treated as an interrupt.
When an interrupt occurs, whether it be caused from a breakpoint or any other type of interrupt, it is conventional that the contents of the instruction pointer are pushed onto the stack, and also that the contents of one or more of the registers are saved. This information, the instruction pointer, as well as the contents of certain registers and flags are saved for several reasons. For one reason, the processor state may include information essential to successful operation of the called routine such as the instruction pointer, flags; and condition codes. For another reason, saving this information is useful so that when the interrupt has finished its operation, program operation can resume at the place where the interrupt occurred. Saving this information takes time, and slows the interrupt process. Furthermore, the simple act of saving registers or reading instructions for a service routine may interfere with diagnosis efforts, particularly in the context of cache consistency problems.
In order to halt operation of a microprocessor according to prior methods, a "hold" pin may be asserted. The hold pin prevents the microprocessor from taking over the memory bus between the cache and main memory. The hold pin is particularly useful for DMA (direct memory access) operations. However, when the hold pin is asserted, the microprocessor continues operations until it requires use of the memory bus, and only then will it cease operations. Therefore it is uncertain at what place, and when, the microprocessor will stop. If the microprocessor has an on-board cache, a feature common in microprocessors, the uncertainty is increased. A cache stores commonly used instructions and data. In a microprocessor with a cache, operations may proceed for quite a long time using the cache instructions and data without the necessity for accessing main memory. In that instance, microprocessor operation may not stop until a very long time after the hold pin has been asserted.